More problems
[andmenj-acm.git] / Mi manual de algoritmos / version_maraton_interuniversitaria_2008-2 / src / c++ / fgetws.tex
blobb55afb9dc3be4df9b0f350ce5025dd1829594c75
1 % Generator: GNU source-highlight, by Lorenzo Bettini, http://www.gnu.org/software/src-highlite
3 {\ttfamily \raggedright {
4 \noindent
5 \mbox{}\textbf{\textcolor{RoyalBlue}{\#include}}\ \texttt{\textcolor{Red}{$<$iostream$>$}} \\
6 \mbox{}\textbf{\textcolor{RoyalBlue}{\#include}}\ \texttt{\textcolor{Red}{$<$cassert$>$}} \\
7 \mbox{}\textbf{\textcolor{RoyalBlue}{\#include}}\ \texttt{\textcolor{Red}{$<$stdio.h$>$}} \\
8 \mbox{}\textbf{\textcolor{RoyalBlue}{\#include}}\ \texttt{\textcolor{Red}{$<$assert.h$>$}} \\
9 \mbox{}\textbf{\textcolor{RoyalBlue}{\#include}}\ \texttt{\textcolor{Red}{$<$wchar.h$>$}} \\
10 \mbox{}\textbf{\textcolor{RoyalBlue}{\#include}}\ \texttt{\textcolor{Red}{$<$wctype.h$>$}} \\
11 \mbox{}\textbf{\textcolor{RoyalBlue}{\#include}}\ \texttt{\textcolor{Red}{$<$locale.h$>$}} \\
12 \mbox{} \\
13 \mbox{} \\
14 \mbox{}\textbf{\textcolor{Blue}{using}}\ \textbf{\textcolor{Blue}{namespace}}\ std\textcolor{BrickRed}{;} \\
15 \mbox{} \\
16 \mbox{}\textcolor{ForestGreen}{int}\ \textbf{\textcolor{Black}{main}}\textcolor{BrickRed}{()}\textcolor{Red}{\{} \\
17 \mbox{}\ \ \textbf{\textcolor{Black}{assert}}\textcolor{BrickRed}{(}\textbf{\textcolor{Black}{setlocale}}\textcolor{BrickRed}{(}LC$\_$ALL\textcolor{BrickRed}{,}\ \texttt{\textcolor{Red}{"{}en$\_$US.UTF-8"{}}}\textcolor{BrickRed}{)}\ \textcolor{BrickRed}{!=}\ NULL\textcolor{BrickRed}{);} \\
18 \mbox{}\ \ \textcolor{ForestGreen}{wchar$\_$t}\ in$\_$buf\textcolor{BrickRed}{[}\textcolor{Purple}{512}\textcolor{BrickRed}{],}\ out$\_$buf\textcolor{BrickRed}{[}\textcolor{Purple}{512}\textcolor{BrickRed}{];} \\
19 \mbox{}\ \ \textbf{\textcolor{Black}{swprintf}}\textcolor{BrickRed}{(}out$\_$buf\textcolor{BrickRed}{,}\ \textcolor{Purple}{512}\textcolor{BrickRed}{,}\ L\texttt{\textcolor{Red}{"{}¿Podrías\ escribir\ un\ número?,\ Por\ ejemplo\ \%d.\ ¡Gracias,\ pingüino\ español!}}\texttt{\textcolor{CarnationPink}{\textbackslash{}n}}\texttt{\textcolor{Red}{"{}}}\textcolor{BrickRed}{,}\ \textcolor{Purple}{3}\textcolor{BrickRed}{);} \\
20 \mbox{}\ \ \textbf{\textcolor{Black}{fputws}}\textcolor{BrickRed}{(}out$\_$buf\textcolor{BrickRed}{,}\ stdout\textcolor{BrickRed}{);} \\
21 \mbox{} \\
22 \mbox{}\ \ \textbf{\textcolor{Black}{fgetws}}\textcolor{BrickRed}{(}in$\_$buf\textcolor{BrickRed}{,}\ \textcolor{Purple}{512}\textcolor{BrickRed}{,}\ stdin\textcolor{BrickRed}{);} \\
23 \mbox{}\ \ \textcolor{ForestGreen}{int}\ n\textcolor{BrickRed}{;} \\
24 \mbox{}\ \ \textbf{\textcolor{Black}{swscanf}}\textcolor{BrickRed}{(}in$\_$buf\textcolor{BrickRed}{,}\ L\texttt{\textcolor{Red}{"{}\%d"{}}}\textcolor{BrickRed}{,}\ \textcolor{BrickRed}{\&}n\textcolor{BrickRed}{);} \\
25 \mbox{} \\
26 \mbox{}\ \ \textbf{\textcolor{Black}{swprintf}}\textcolor{BrickRed}{(}out$\_$buf\textcolor{BrickRed}{,}\ \textcolor{Purple}{512}\textcolor{BrickRed}{,}\ L\texttt{\textcolor{Red}{"{}Escribiste\ \%d,\ yo\ escribo\ ¿ÔÏàÚÑ\textasciitilde{}}}\texttt{\textcolor{CarnationPink}{\textbackslash{}n}}\texttt{\textcolor{Red}{"{}}}\textcolor{BrickRed}{,}\ n\textcolor{BrickRed}{);} \\
27 \mbox{}\ \ \textbf{\textcolor{Black}{fputws}}\textcolor{BrickRed}{(}out$\_$buf\textcolor{BrickRed}{,}\ stdout\textcolor{BrickRed}{);} \\
28 \mbox{} \\
29 \mbox{}\ \ \textbf{\textcolor{Blue}{return}}\ \textcolor{Purple}{0}\textcolor{BrickRed}{;} \\
30 \mbox{}\textcolor{Red}{\}} \\
31 \mbox{} \\
32 \mbox{} \\
34 } \normalfont\normalsize